import request from '@/utils/request'
import type { CategoryType, CategoryQuery, CategoryResponse } from '@/types/furniture'

// 获取分类列表
export function getCategoryList(params: CategoryQuery) {
  return request<CategoryResponse>({
    url: '/category/list',
    method: 'get',
    params
  })
}

// 添加分类
export function addCategory(data: Omit<CategoryType, 'id' | 'createTime'>) {
  return request<string>({
    url: '/category/add',
    method: 'post',
    data
  })
}

// 更新分类
export function updateCategory(data: Partial<CategoryType> & { id: string }) {
  return request<void>({
    url: '/category/update',
    method: 'put',
    data
  })
}

// 删除分类
export function deleteCategory(id: string) {
  return request<void>({
    url: `/category/delete/${id}`,
    method: 'delete'
  })
}

// 更新分类状态
export function updateCategoryStatus(id: string, status: number) {
  return request<void>({
    url: '/category/status',
    method: 'put',
    data: { id, status }
  })
} 